from django import forms
from web.forms.bootstrap import BootstrapForm
from web import models

class WikiModelForm(BootstrapForm,forms.ModelForm):
    class Meta:
        model=models.Wiki
        exclude=['project','depth']
    def __init__(self,request,*args,**kwargs):
        super().__init__(*args,**kwargs)
        total_data=[('','请选择'),]
        _=models.Wiki.objects.filter(project=request.tracer.project).values_list('id','title')
        total_data.extend(_)
        self.fields.get('parent').choices=total_data
